'''
class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def greet(self):
        return f"Name: {self.name}, Age: {self.age}"

Person1 = Person("Alice", 30)
Person2 = Person("Bob", 25)
Person3 = Person("Charlie", 35)

print(Person1.greet())
print(Person2.greet())
print(Person3.greet())'''


import random

class Aminal:
    def __init__(self,name,speed):
        self.name=name
        self.speed=speed
        self.distance = 0
    def run(self):
        step = random.randint(1,self.speed)
        self.distance += step
        print(f"{self.name} 跑了{step}米，目前的速度是{self.speed} km/h，总归跑了{self.distance}米")
    
class Race:
    def __init__(self,distance,animals):
        self.distance = distance
        self.animals = animals

    def start(self):
        while True:
            for animal in self.animals:
                animal.run()
                if animal.distance >= self.distance:
                    print(f"{animal.name} 得了MVP！")
                    return
rabbit = Aminal("兔子", 10)
turtle = Aminal("乌龟", 5)

race=Race(100,[rabbit,turtle])
race.start()